#include "processbar.h"
#define LEN 101
const char* style = "|-/\\";

//void ProcessBar()
//{
//    char buff[LEN] = { 0 };
//    int i;
//    for (i = 0; i <= 100; ++i)
//    {
//        printf("[%-100s][%d%%][%c]\r", buff, i, style[i%4]);
//        fflush(stdout);
//        buff[i] = '=';
//        usleep(100000);
//    }
//    printf("\n");
//
//}

void ProcessBar(double total, double current)
{   
    char buff[LEN] = { 0 };
    int i;
    int len = current * 100 / total;
    double rate = current / total;
    for (i = 0; i <= 100; ++i)
    {
        printf("[%-100s][%d%%][%c]\r", buff, i, style[i%4]);
        fflush(stdout);
        buff[i] = '=';
        usleep(100000);
    }
    printf("\n");

}
